package com.xlobo.api.fund.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 获取账户信息Call FreeMaker Template自动生成代码
 */
public class InfoCall extends YmatouBaseCall {
	private static String opurl = "Account/Info";

	public InfoCall() {
		super(EnvSetup.getSystemUrl("fund_api_xlobo"), opurl, "GET", "PARAM");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取AccountId
	 * 
	 * @return AccountId
	 */
	public String getAccountId() {
		String AccountId = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			AccountId = String.valueOf(jo.get("AccountId"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return AccountId;
	}

	/**
	 * 获取AccountType
	 * 
	 * @return AccountType
	 */
	public String getAccountType() {
		String AccountType = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			AccountType = String.valueOf(jo.get("AccountType"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return AccountType;
	}

	/**
	 * 获取UserId
	 * 
	 * @return UserId
	 */
	public String getUserId() {
		String UserId = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			UserId = String.valueOf(jo.get("UserId"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return UserId;
	}

	/**
	 * 获取Msg
	 * 
	 * @return Message
	 */
	public String getMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = String.valueOf(jo.get("Message"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}

	/**
	 * 获取账号金额TotalAmount
	 * 
	 * @return TotalAmount
	 */
	public Double getTotalAmount() {
		Double TotalAmount = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			TotalAmount = (Double) jo.get("TotalAmount");

		} catch (Exception e) {
			e.printStackTrace();
		}
		return TotalAmount;
	}

	/**
	 * 获取可用金额AvailableAmount
	 * 
	 * @return AvailableAmount
	 */
	public Double getAvailableAmount() {
		Double AvailableAmount = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			AvailableAmount = (Double) jo.get("AvailableAmount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return AvailableAmount;
	}

	/**
	 * 获取冻结金额FreezeAmount
	 * 
	 * @return FreezeAmount
	 */
	public Double getFreezeAmount() {
		Double FreezeAmount = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			FreezeAmount = (Double) jo.get("FreezeAmount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return FreezeAmount;
	}

	/**
	 * 获取GiftAmount
	 * 
	 * @return GiftAmount
	 */
	public Double getGiftAmount() {
		Double GiftAmount = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			GiftAmount = (Double) jo.get("GiftAmount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return GiftAmount;
	}

	/**
	 * 获取交易密码TradingPassword
	 * 
	 * @return TradingPassword
	 */
	public String getTradingPassword() {
		String TradingPassword = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			TradingPassword = (String) jo.get("TradingPassword");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return TradingPassword;
	}

	/**
	 * 获取错误Msg
	 * 
	 * @return Msg
	 */
	public String getErrorMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = (String) jo.get("Message");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}

	/**
	 * 获取UserName
	 * 
	 * @return Msg
	 */
	public String getUserName() {
		String UserName = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			UserName = (String) jo.get("UserName");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return UserName;
	}
}